import { createRouter, createWebHistory } from 'vue-router'
import LoginView from '../views/LoginView.vue'
import Layout from '@/layout/Layout.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'login',
      component: LoginView
    },
    {
      path: '/',
      component: Layout,
      redirect: '/dashboard',
      children: [
        {
          path: 'dashboard',
          name: 'Dashboard',
          component: () => import('../views/dashboard/index.vue'),
          meta: { title: '首页' }
        },
        {
          path: 'hospital',
          name: 'Hospital',
          component: () => import('../views/hospital/index.vue'),
          meta: { 
            title: '医院管理',
            requiresAuth: true,
            icon: 'Hospital'
          }
        },
        {
          path: 'system/user',
          name: 'User',
          component: () => import('../views/system/User.vue'),
          meta: { 
            title: '用户管理',
            requiresAuth: true,
            icon: 'User'
          }
         },
      
        {
          path: 'task',
          name: 'Task',
          component: () => import('../views/task/index.vue'),
          meta: {
            title: '任务管理',
            requiresAuth: true,
            icon: 'Timer'
          }
        },
        {
          path: 'task/log',
          name: 'TaskLog',
          component: () => import('../views/task/log/index.vue'),
          meta: {
            title: '任务日志',
            requiresAuth: true,
            icon: 'Document'
          }
        }
        // 新增路由结束
      ]
    },
    {
      path: '/about',
      name: 'about',
      component: () => import('../views/AboutView.vue'),
      meta: { requiresAuth: true }
    },
  ],
})

export default router
